FROM ubuntu:22.04 AS tools
ADD jdk-8u381-linux-x64.tar.gz /
ADD apache-maven-3.6.0-bin.tar.gz /
COPY settings.xml /apache-maven-3.6.0/conf

FROM ubuntu:22.04
ENV TZ Asia/Shanghai
COPY --from=tools /jdk1.8.0_381 /jdk1.8.0_381
COPY --from=tools /apache-maven-3.6.0 /apache-maven-3.6.0
RUN sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list\
    &&  apt-get -y update && apt-get install -y tzdata \
    && echo ${TZ} > /etc/timezone \
    && apt-get clean all \
    && rm -rf /var/cache/apt \
    && mkdir /apache-maven-3.6.0/maven-repo
VOLUME [ "/apache-maven-3.6.0/maven-repo" ]
ENV JAVA_HOME=/jdk1.8.0_381
ENV MAVEN_HOME=/apache-maven-3.6.0
ENV MAVEN_VERSION=3.6.0
ENV PATH=$JAVA_HOME/bin:${MAVEN_HOME}/bin/:$PATH